﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.BLL.DisjoinProForOutShop;
using MINERP.MODEL.FoundationModel;

namespace MINERP.DisjoinProForOutShop.Forms
{
    public partial class FrmSignShopByArea : Form
    {
        public FrmSignShopByArea()
        {
            InitializeComponent();
        }
        DisJoinBLL2_Fuji _bll = new DisJoinBLL2_Fuji();
        public delegate void SendAreaSearch(List<Shop_Info> listShop);
        public event SendAreaSearch SendAreaGridColor;
        List<Shop_Info> shopList = new List<Shop_Info>();
        List<string> AreaList = new List<string>();

        private void FrmSignShopByArea_Load(object sender, EventArgs e)
        {
               shopList=_bll.GetAllShop();
             
              foreach (Shop_Info shop in shopList)
              {
                  if (!AreaList.Contains(shop.Area))
                  {
                      AreaList.Add(shop.Area);
                  }
              }
              comboBoxAreas.DataSource = AreaList;

        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            string strArea = comboBoxAreas.Text;
            SendAreaGridColor(shopList.Where(p => p.Area == strArea).ToList());
            this.Close();
        }
    }
}
